home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / C64 / U-Utilities / (c)u1.d64 / dissambler.c (.txt) < prev    next >
Commodore BASIC  |  2007-02-04  |  4KB  |  124 lines

  1. 5 POKE53280,1:POKE53281,1:POKE53272,21:REM         C64 MODS 1983
  2. 6 POKE1011,173:POKE1014,141
  3. 7 POKE1015,242:POKE1016,3:POKE1017,96
  4. 8 DEF FNA(W)=(FNB(WAND127)-32AND63)+32
  5. 9 DEF FNB(W)=(32+W)/2+ABS(32-W)/2
  6. 40 PRINT"[144][147]          6502     DISASSEMBLER         ":PRINT
  7. 50 INPUT"TAPE FILE OUTPUT (Y OR N) ";FO$
  8. 55 IFFO$<>"Y"ANDFO$<>"N"THEN50
  9. 56 INPUT"PRINTER OUTPUT (Y OR N) ";PO$
  10. 57 IFPO$<>"Y"THEN100
  11. 58 PRINT"TURN ON PRINTER, HIT ANY KEY"
  12. 59 GETA$:IFA$=""GOTO59
  13. 60 OPEN5,5
  14. 100 DIM NM$(56),OP%(255),NB(13):NM$(0)="???":H$="0123456789ABCDEF"
  15. 110 SP$="                    "
  16. 200 FORI=0TO6:READ A$:FORJ=1TO8:NM$(I*8+J)=MID$(A$,J*3-2,3):NEXT:NEXT
  17. 210 DATA "ADCANDASLBCCBCSBEQBITBMI"
  18. 220 DATA "BNEBPLBRKBVCBVSCLCCLDCLI"
  19. 230 DATA "CLVCMPCPXCPYDECDEXDEYEOR"
  20. 240 DATA "INCINXINYJMPJSRLDALDXLDY"
  21. 250 DATA "LSRNOPORAPHAPHPPLAPLPROL"
  22. 260 DATA "RORRTIRTSSBCSECSEDSEISTA"
  23. 270 DATA "STXSTYTAXTAYTSXTXATXSTYA"
  24. 280 FORI=0TO255:READ OP%(I):NEXT
  25. 310 DATA1105,3506,0,0,0,3503,303,0
  26. 320 DATA3705,3501,304,0,0,3502,302,0
  27. 330 DATA1011,3507,0,0,0,3508,308,0
  28. 340 DATA1405,3510,0,0,0,3509,309,0
  29. 350 DATA2902,206,0,0,703,203,4003,0
  30. 360 DATA3905,201,4004,0,702,202,4002,0
  31. 370 DATA811,207,0,0,0,208,4008,0
  32. 380 DATA4505,210,0,0,0,209,4009,0
  33. 390 DATA4205,2406,0,0,0,2403,3303,0
  34. 400 DATA3605,2401,3304,0,2802,2402,3302,0
  35. 410 DATA1211,2407,0,0,0,2408,3308,0
  36. 420 DATA1605,2410,0,0,0,2409,3309,0
  37. 430 DATA4305,106,0,0,0,103,4103,0
  38. 440 DATA3805,101,4104,0,2812,102,4102,0
  39. 450 DATA1311,107,0,0,0,108,4108,0
  40. 460 DATA4705,110,0,0,0,109,4109,0
  41. 470 DATA0,4806,0,0,5003,4803,4903,0
  42. 480 DATA2305,0,5405,0,5002,4802,4902,0
  43. 490 DATA411,4807,0,0,5008,4808,4913,0
  44. 500 DATA5605,4810,5505,0,0,4809,0,0
  45. 510 DATA3201,3006,3101,0,3203,3003,3103,0
  46. 520 DATA5205,3001,5105,0,3202,3002,3102,0
  47. 530 DATA511,3007,0,0,3208,3008,3113,0
  48. 540 DATA1705,3010,5305,0,3209,3009,3110,0
  49. 550 DATA2001,1806,0,0,2003,1803,2103,0
  50. 560 DATA2705,1801,2205,0,2002,1802,2102,0
  51. 570 DATA911,1807,0,0,0,1808,2108,0
  52. 580 DATA1505,1810,0,0,0,1809,2109,0
  53. 590 DATA1901,4406,0,0,1903,4403,2503,0
  54. 600 DATA2605,4401,3405,0,1902,4402,2502,0
  55. 610 DATA611,4407,0,0,0,4408,2508,0
  56. 620 DATA4605,4410,0,0,0,4409,2509,0
  57. 650 FORI=0TO13:READ NB(I):NEXT
  58. 660 DATA 1,2,3,2,1,1,2,2,2,3,3,2,3,2
  59. 680 PG=1:LL=1:LN=99
  60. 700 INPUT"START ADDRESS ";AD$:AD=0:IFLEFT$(AD$,1)<>"$"THENAD=VAL(AD$):GOTO709
  61. 702 AD$=MID$(AD$,2,6):IFAD$=""THEN709
  62. 703 N=ASC(AD$)-48:IFN>9THENN=N-7
  63. 704 IFN<0ORN>15THEN709
  64. 705 AD=AD*16+N:GOTO702
  65. 709 PRINT"[147]":HD$="ADDR CONTENTS SYMBOLIC    ASCII DECIMAL":O$=HD$:GOSUB980
  66. 710 O$="":NN=AD:GOSUB20000:O$=O$+" "
  67. 712 GOSUB2000:B0=PEEK(1010):AM=OP%(B0)-INT(OP%(B0)/100)*100:B1=32:B2=32
  68. 715 NB=NB(AM):N=B0:GOSUB10000:O$=O$+" "
  69. 717 IFNB=1THEN:O$=O$+"     ":GOTO740
  70. 720 GOSUB2000:B1=PEEK(1010):GOSUB9010:O$=O$+" ":IFNB=2THENO$=O$+"  ":GOTO740
  71. 730 GOSUB2000:B2=PEEK(1010):N=B2:GOSUB10000
  72. 740 O$=O$+" "+NM$(INT(OP%(B0)/100))+" ":CM$=""
  73. 745 ONAM+1GOTO750,760,770,780,790,900,810,820,830,840,850,860,870,880
  74. 750 CM$="?DATA?":GOTO900
  75. 760 O$=O$+"#":GOSUB9000:GOTO900
  76. 770 GOSUB19000:GOTO900
  77. 780 GOSUB9000:GOTO900
  78. 790 O$=O$+"A":GOTO900
  79. 810 O$=O$+"(":GOSUB9000:O$=O$+",X)":GOTO900
  80. 820 O$=O$+"(":GOSUB9000:O$=O$+"),Y":GOTO900
  81. 830 GOSUB9000:O$=O$+",X":GOTO900
  82. 840 GOSUB19000:O$=O$+",X":GOTO900
  83. 850 GOSUB19000:O$=O$+",Y":GOTO900
  84. 860 NN=AD+B1:IFB1>127THENNN=NN-256
  85. 863 GOSUB19010:GOTO900
  86. 870 O$=O$+"(":GOSUB19000:O$=O$+")":GOTO900
  87. 880 GOSUB9000:O$=O$+",Y"
  88. 900 O$=O$+LEFT$(SP$,27-LEN(O$))+";"+CHR$(FNA(B0))+CHR$(FNA(B1))+CHR$(FNA(B2))
  89. 910 O$=O$+RIGHT$(SP$+CM$,6)
  90. 950 GETQQ$:IFQQ$="E"THENCLOSE1:CLOSE5:END
  91. 955 IFQQ$="A"THEN700
  92. 960 IFQQ$<>"S"THEN978
  93. 970 GETQQ$:IFQQ$="G"THEN978
  94. 972 IFQQ$="A"THEN700
  95. 975 IFQQ$="E"THENCLOSE1:CLOSE5:END
  96. 977 GOTO970
  97. 978 GOSUB980:GOTO710
  98. 980 PRINT O$
  99. 985 IFFO$="Y"THENPRINT#1,O$:GOSUB1000
  100. 986 IFPO$="Y"THENPRINT#5,O$
  101. 990 RETURN
  102. 1000 SZ=SZ+LEN(O$)+1
  103. 1010 IFSZ<192THENRETURN
  104. 1020 POKE59411,53:T=TI
  105. 1030 IFTI-T<6THEN1030
  106. 1040 POKE59411,61
  107. 1050 SZ=SZ-191
  108. 1060 RETURN
  109. 2000 POKE1012,AD-INT(AD/256)*256:POKE1013,AD/256
  110. 2010 SYS1011:AD=AD+1:RETURN
  111. 9000 O$=O$+"$"
  112. 9010 N=B1
  113. 10000 N=INT(N):N1=INT(N/16)
  114. 10010 O$=O$+MID$(H$,N1+1,1)+MID$(H$,N-16*N1+1,1)
  115. 10015 IFN>9THENCM$=STR$(N)
  116. 10020 RETURN
  117. 19000 NN=B1+256*B2
  118. 19010 O$=O$+"$"
  119. 20000 N=NN/256:GOSUB10000:N=NN-INT(NN/256)*256:GOSUB10000
  120. 20010 IFNN>9THENCM$=STR$(NN)
  121. 20020 RETURN
  122. 50000 OPEN1
  123. 50010 INPUT#1,A$:PRINTA$:GOTO50010
  124.